package com.specialtreasure.freightdepot.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/8/7 0007.
 * 信息管理适配器 懒加载适配器
 */

public class InformationPageAdapter extends FragmentPagerAdapter {
    private String[] TITLES;
    private List<Fragment> infos = new ArrayList<Fragment>();

    public InformationPageAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return TITLES[position];
    }

    @Override
    public int getCount() {
        return TITLES.length;
    }

    @Override
    public Fragment getItem(int position) {
        return infos.get(position);
    }


    public void setInfos(List<Fragment> infos) {
        this.infos = infos;
    }

    public void setTITLES(String[] TITLES) {
        this.TITLES = TITLES;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
//        super.destroyItem(container, position, object);
    }

}
